package com.wxm.mqttintegrationdoc.mqtt;

import com.wxm.mqttintegrationdoc.protocol.User;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.messaging.MessageHandler;
import org.springframework.stereotype.Component;

@Component
public class Receiver {
    @Bean
    @ServiceActivator(inputChannel = "mqttInboundChannel")
    public MessageHandler handleMessage() {
        return message -> {
            User payload = (User)message.getPayload();
            System.out.println(payload);
        };
    }
}
